package com.yanqu.road.entity.activity.busyfarming;

import com.alibaba.fastjson.JSON;
import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.player.UserBaseInfo;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

@FieldTypeAnnotation(tableName = "t_u_activity_busy_farming_stolen_record")
public class BusyFarmingStolenRecord extends DataObject {

    @FieldTypeAnnotation(update = true, desc = "按活动自增的ID")
    private long dbId;
    @FieldTypeAnnotation(update = true, desc = "用户ID")
    private long userId;
    @FieldTypeAnnotation(select = true, update = true, desc = "活动ID")
    private int activityId;

    @FieldTypeAnnotation(desc = "对方ID")
    private long enemyId;
    @FieldTypeAnnotation(desc = "对方区服ID")
    private long enemyServerId;
    @FieldTypeAnnotation(desc = "损失")
    private String loss;
    @FieldTypeAnnotation(desc = "参数")
    private List<String> params = new ArrayList<>();
    @FieldTypeAnnotation(desc = "对方基础数据")
    private UserBaseInfo userBaseInfo;
    @FieldTypeAnnotation(desc = "被偷时间")
    private int stolenTime;

    @FieldTypeAnnotation(desc = "是否删除")
    private boolean del;
    @FieldTypeAnnotation(desc = "是否已读")
    private boolean readed;

    public long getDbId() {
        return dbId;
    }

    public void setDbId(long dbId) {
        if(this.dbId != dbId) {
            this.dbId = dbId;
            setUpdateOption();
        }
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        if(this.userId != userId) {
            this.userId = userId;
            setUpdateOption();
        }
    }

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        if(this.activityId != activityId) {
            this.activityId = activityId;
            setUpdateOption();
        }
    }

    public long getEnemyId() {
        return enemyId;
    }

    public void setEnemyId(long enemyId) {
        if(this.enemyId != enemyId) {
            this.enemyId = enemyId;
            setUpdateOption();
        }
    }

    public long getEnemyServerId() {
        return enemyServerId;
    }

    public void setEnemyServerId(long enemyServerId) {
        if(this.enemyServerId != enemyServerId) {
            this.enemyServerId = enemyServerId;

        }
    }

    public String getLoss() {
        return loss;
    }

    public void setLoss(String loss) {
        if(!Objects.equals(this.loss, loss)) {
            this.loss = loss;
            setUpdateOption();
        }
    }

    public List<String> getParams() {
        return params;
    }

    public void setParams(List<String> params) {
        this.params = params;
    }

    public UserBaseInfo getUserBaseInfo() {
        return userBaseInfo;
    }

    public void setUserBaseInfo(UserBaseInfo userBaseInfo) {
        this.userBaseInfo = userBaseInfo;
        setUpdateOption();
    }

    public String getBaseInfoJsonStr(){
        if(null == userBaseInfo){
            return "";
        }else {
            return JSON.toJSONString(userBaseInfo);
        }
    }

    public int getStolenTime() {
        return stolenTime;
    }

    public void setStolenTime(int stolenTime) {
        if(this.stolenTime != stolenTime) {
            this.stolenTime = stolenTime;
            setUpdateOption();
        }
    }

    public boolean isDel() {
        return del;
    }

    public void setDel(boolean del) {
        if(this.del != del) {
            this.del = del;
            setUpdateOption();
        }
    }

    public boolean isReaded() {
        return readed;
    }

    public void setReaded(boolean readed) {
        if(this.readed != readed) {
            this.readed = readed;
            setUpdateOption();
        }
    }

}
